﻿using System;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ArrayList arrayList = new ArrayList() { 1, 2, 3 };
            foreach (var v in arrayList)
            {
                Console.WriteLine(v);
            }


            ArrayList list = new ArrayList() { "aba", "bab", "cac" };
            int ind = list.IndexOf("abc");
            if (ind != -1)
            {
                Console.WriteLine("存在");
            }
            else
            {
                Console.WriteLine("不存在");
            }



            ArrayList list1 = new ArrayList() { 1, 2, 3, 4, 5, 6 };
            ArrayList inter = new ArrayList();
            for (int i = 0; i < list1.Count; i += 2)
            {
                inter.Add(list1[i]);
            }
            foreach (var j in inter)
            {
                Console.WriteLine(j);
            }




            ArrayList list2 = new ArrayList() { "asd", "sdf", "dfg", "fgh", "ghj" };
            ArrayList array = new ArrayList() { "qwe", "wer", "ert" };
            list2.InsertRange(1, array);
            foreach (var x in list2)
            {
                Console.WriteLine(x);
            }





            ArrayList list3 = new ArrayList() { "aaa", "bbb", "ccc" };
            list3.Sort();
            foreach (var m in list3)
            {
                Console.WriteLine(m);
            }





            ArrayList list4 = new ArrayList() { 1, 2, "q", "r" };
            MyCompare myCompare = new MyCompare();
            list4.Sort(myCompare);
            foreach (var a in list4)
            {
                Console.WriteLine(a);
            }





        }
    }
}
